#!/bin/bash
echo "Hello World !"

for file in `ls`
do
# for file in $(ls /etc); do
    # echo $file
    if [ -w $file ]
    then
        echo $file "文件可写"
    else
        echo $file "文件不可写"
    fi
done

a=10
b=20
val=`expr $a + $b`
echo "a + b : $val"

if [ $a -le $b ]
then
   echo "$a -le $b: a 小于或等于 b"
else
   echo "$a -le $b: a 大于 b"
fi

if [ $a -lt 100 -a $b -gt 15 ]
then
   echo "$a 小于 100 且 $b 大于 15 : 返回 true"
else
   echo "$a 小于 100 且 $b 大于 15 : 返回 false"
fi

printf "%-10s %-8s %-4.2f\n" 郭靖 男 66.1234 


site="runoob"
case "$site" in
    "runoob") 
        echo "菜鸟教程"
        ;;
    "google") 
        echo "Google 搜索"
        ;;
    "taobao") 
        echo "淘宝网"
        ;;
esac


# awk -F' ' '{print $1}' log.txt

# echo $*

echo ' ---------------   '

awk -F' ' '{for(i=1;i<=NF;i++) res[$i]+=1}END {for(v in res)print v" "res[v]}' log.txt | sort -nr -k2

